/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("ProductPlan",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using VOL.Entity.DomainModels;
using VOL.Product.IServices;
using VOL.Product.IRepositories;
using VOL.Product.Repositories;
using Microsoft.EntityFrameworkCore;

namespace VOL.Product.Controllers
{
    public partial class ProductPlanController
    {
        private readonly IProductPlanService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;
        private readonly IProductPlanListRepository _productPlanListRepository;

        [ActivatorUtilitiesConstructor]
        public ProductPlanController(
            IProductPlanService service,
            IHttpContextAccessor httpContextAccessor,
            IProductPlanListRepository productPlanListRepository
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
            _productPlanListRepository = productPlanListRepository;
        }
        [Route("getDetailRows"), HttpGet]
        public async Task<IActionResult> GetDetailRows(int ProductPlan_Id)
        {
            var rows = await _productPlanListRepository.FindAsIQueryable(x => x.ProductPlan_Id == ProductPlan_Id).ToListAsync();
            return JsonNormal(rows);

        }
    }
}
